#!/bin/sh
#
# Usage: guide [ <filename> ]
#
# Runs the given script file and compares resulting temporary log with
# corresponding log file <filename>.guide, if it exists
#
dir=`dirname $0`/..
java -cp "$dir/class:$dir/lib/jing.jar:$dir/lib/js-engine5.jar" edu.wpi.cetask.guide.Guide $1
if [ "$1" ]; then
  good=$1.guide
  if [ -f $good ]; then 
    # ignore comments and blank  lines (Unix and Windows)
    diff -qBI "^.$\|\#" /tmp/`basename $1`.guide $good
    diff=$?
    if [ $diff == 0 ]; then echo Succeed `basename $1`; fi;
    exit $diff
  fi;
fi
